import React from 'react';
import { HomePage, SignInPage, RegisterPage, DetailPage } from './pages'
import { BrowserRouter, Route, Switch } from 'react-router-dom'
import styles from './App.module.css'
function App() {
  return (
    <div className={styles.App}>
      <BrowserRouter>
        {/*switch避免了页面叠加渲染，每次只渲染一个页面。需注意顺序，404页面放在最后*/}
        <Switch>
          <Route exact path="/" component={HomePage}></Route>
          <Route path="/signIn" component={SignInPage}></Route>
          <Route path="/register" component={RegisterPage}></Route>
          <Route path="/detail/:touristId" component={DetailPage}></Route>
          <Route render={() => <h1>404页面</h1>} />
        </Switch>
      </BrowserRouter>
    </div>
  );
}

export default App;
